fixed some test and did some refactoring of the tests