Added scan function