Added endgame system, reformatted crappily indented code