Refactored app.js and gameserver.js