Fixed issue #1, updated unit tests