Adding helper method to widget.js