Replace multiple calls to format_category