code cleanup in InsertScan