Optimilization and file output.