starting with scanning algorythm