bug fixed - Change suggested by Zain Basharat
commented the loop details