restructure so player code can be reused for other entities