Include pmgarman's improvements

Submitting this for @pmgarman as his improvements make this script *much* nicer.