Added main loop and basic dynamics equations