Added unit tests, fixed issue#18