Make scanning work, add more tests.