added onComplete and onClose events