Resolves #28 and fixes #29