Break up the sweeper script into something a little more readable.