Refactored player class and overall code structure