Refactor various formatting methods