applying changes from PR#87