Made layout more robust with weird nodes (like SVG) in the mix