Refactored player controller. Still a bit messy.