Changes to make the scanner work in portrait mode