Added validation that stuff is well-nested.