Added more total label filtering
Removed duplicate code