Modularize game logic