Modified js code for the widget. PEP8 fixes. Code cleaning.