Fixed an issue with the maxNode routine
Add optional parameter for first direction