refactor loop. i can haz ruby