extracted methods from game loop