Modified scan

Corrected to iterate over results in for loop