further improvements output and removed "useless iteration" at the beginning