replace the cheerio extend method's recusive  call with iterative call