Added writing to files