move the core game functions into a separate factory service