Various useful functions.