add resetGlobals method, clean up transform