all code restructured for gain the JSHint test