restructure code so the player singleton gets used