Added scanning function