Implements a better solution to the file save problem