Added traversals, cleaned up code