Switched from using function to set event handler to a hander map.