Some useful functions.