Implemented saveing data into files