Python - Rewriting the files to be better I guess