Apply code convention.
Fix bug with not writing all files that exist twice to the file.