Misc functions.