Various utility functions.