Refactored player logic into functions
Merge pull request #42 from jyek/master

Refactored player logic into functions