Implemented scanning functionality