Much improved handling of element attributes