incorporate feedback and add unit test