Merging most of PR#1 from @wadeschulz.

Thanks, @wadeschulz!
Fixes #1.