Add autosave function and improve mappings