Implemented scan logic