Refactor exclusion code