adds macros and refines pendulum example