Fixing issue #39

This should work, although it isn't pretty.

Let me know what you think.