fixed recurrise issue and add the loop method