Refactored tests

Refactoring and clean up for unit tests