bit of cleanup, added unit test