Some optimisations to node resolution algorithm