implemented inline before/after callbacks for events