Reworking the save functionality. Still more work and testing to be done.