Refactor number formatting