added support for filtering out non-element nodes