Refactored and simplied some of the test