big update to pendulum.py (see list of bugs for what still needs to be done)