merge and refactored unit tests