Second pass at #450
Merge pull request #1096 from kuyan/master

Second pass at #450