Fixed some bugs with the player and refactored / cleaned up the code a bit.