added scanning logic