modified the dynamic positioning and resizing of widgets