recursive scan