almost finished game loop