Plans and the structure of behavior