added some math to the scanner