Cleaned up code in AutomaticScan class.