Miscellaneous helpful utility code.