Changes for issue #11

Made the changes in the correct branch this time.
fixed #11

Added tests to finish and verify the fix for this issue.