added recursion for nested Elements