added exists util
added exists check
now using while in list generation.
added exists check