Writing to files now fully works