implementing scan
validate scan function