Tyler's modifications to scan program