rebase pull request #32

Addresses #31 and #17