fix everything for assignment 1= =
fix file writing