Scanner improvements.
Code cleanup