formatting
writes to file