Implemented addition and removal of listeners.