Improved Utility Functions

I want to use this in some of my upcoming fixers.
This was taken from your other pull, so it is useful enough that it's used in 2 places here, so shouldn't be duplicated. Maybe I've misunderstood you?