removed duplicated code. Added a counter for excluded routes