Changed structure to be more independent from dom-layout

+ Smaller fixes