More refactoring to grengine.