Now writes to file successfully!