remove comment
refactor out visited_nodes
Refactor enumerable calls into single lines