Formatting and function templates