Minor improvements on the scanner