engine code in Engine.hs