moving everything to a main game loop