Added a scan function.