Write files
Code cleanup