In order to survive in an ever-changing, complex world, animals need be able to flexibly respond to sensory stimuli in a context-dependent way. Despite the ubiquitous importance of behavioral flexibility, its neuronal underpinnings are poorly understood. Jan M. Ache and his lab are trying to unravel the neuronal mechanisms enabling flexible, adaptive behavior. To this end, they are combining cutting-edge methods such as detailed circuit reconstruction, optogenetics and in-vivo physiology in behaving fruit flies. Currently, they are focusing on the effects of internal states on descending motor pathways.