Finished the scanner and many other fixes