Initial implementation of score and cleaned up the main game loop