Made a few changes to scanner