Change output on format change. Plus modularize code.