Exclude pattern rebased

This is #1651 rebased and with the feedback I left there addressed.