tried to implement writing to a file