This resolves #39, fixes #40