Using decrementlevel inside the while loop