Patched according to @rjmackay's patch. Closes #52