Save functionality works properly

Can now save and load from file.