First pass at #269
Merge pull request #725 from shwei/patch-1

First pass at #269