Added gears and endgame (plus fixed some bugs)