Fixed the setHandler method to set the correct listeners.