added pendulum code