Refactor the ignore/exclude logic