a wee bit of refactoring, removing redundant code.

used a listener after the renderWidgetEditBody function