Refactored the tests and added new tests