Merging in changes by @GromNaN, resolves #83.