working out game functions