Handle nested elements