added unit tests and coverage