The basal ganglia (there’s several of them) are central to how the brain stores routine functions. These functions are called routines because they are steps that fit together in a certain order, as in a dance. Your basal ganglia recognize, store, and repeat patterns in your environment. The basic operating principle is somewhat like the “if-then” function in software coding.