Mental Programs and Goal-directed Behaviour