Add formatting to output
Formatting and refactoring