Added scanning code