added unit tests from review and did more cleaning up