Second pass at #252
Merge pull request #871 from NickMk/master

Second pass at #252