added onSave option