added save function to datamanager