Refactor out ScanThread class.