Moved listener and handler into their own classes