Handles onOK, onCancel