refactor gameplay code to be more conventional