added unit tests to cover some edge cases