Base case for traverse()