Common helper functions.