clean code in GameLayer.js