Added conditional to exclude comment nodes