rewrote game engine