Move formatting functions from phone endpoint into utility methods