Added writing to file - not working