Refactors Index.format_name/1 to use pattern matching instead of case