Optimized the movement code for both the camera and player.