Corrected typo
Added emitEvents() function