Added tests for scan function