Added solution for orphaned elements