Added an option to use recrsion or not while finding data