filtering node lookups
tidying up
pushing that logic down
parameterising in an attempt to speed up stuff