Planning before action