fixing iteration bug, using _ utilities, and formatting tidy up

ng iteration bug, using _ utilities, and formatting tidy up