Port chriswailes changes (#10)

This pull request should not introduce backwards incompatibility.