depth-first & breadth-first

made variables accessible, revised if, for, & while statements