removes more globals, fixes bugs in reset