moved widget code into helper