Added writing to file