Move formatting to seperate function