Write to file now works