Refactored to interface with more chat clients.