Unit testing hw slightly refactored