Got rid of recursion, not done iterativly