Cleaned up tests

I removed the global vars in unit tests and cleaned up some of the tests.