Remove duplicate implementation of excludes functionality, and support excluding