Updated Scanning Algorithm