Slightly modified node finding algorithm