added event listener and fixed function name