filtering out irrelevant nodes