refactor formatting to allow formats specifed on a per-file basis