simplifications suggested by @heatherleaf