Miscellaneous helper functions.
