Use valid instead of null check for widgets.
Update class to use Chat API rather than hard coding widgets.