added scan function

note: the scan function doesn't work yet