How the Brain Cultivates Habits