Refactor NodeFinder to use generics