optimizations in games.js