move handlers into widget.js file