Refactored player logic