Fixed incorrect positioning of nested elements

Elements appear now in slightly more predictable ways. This could
actually be helpful when making UIs.