addressed code review
added unit tests