Fixed issues #45 and added a supporting unit test

Fixed issue #45 and added a supporting unit test