Rewrote a lot of the scrubbing code to get it to work correctly