Cleanup and bugfix

cleanup of globals, some renaming and an important bugfix; using pairs instead of ipairs (pairs has an undefined order), which might cause setup, before_each, etc. to run in an incorrect order (only with multiple nested levels)