refactored player_handler to c++ class