Refactored Widget objects building (in JS)