REV: Refactored all code to think of the pattern as a background.