Added a chat listener. Registered chat listener in main.