Added game engine logic