Second pass at #238
Merge pull request #811 from NickMk/master

Second pass at #238