The scanner code