created a formatter object

the formatting and writing was placed into a separate object. This
functionality may or may not work out in the long term.