Fixed add-node function for building the navigation tree