code for scan Done