Updated game loop logic, created helper methods