Merged pull request 25 and added unit test