Moved the duplicate parse/format stuff to its own class