Pull small functions out into a utilities file

This is meant for sourcing from the file it's used in