Some scan pytohn code speedup (this is about 3-5%).
Incomplete C code for scan (all output processing is missing, as is most of the support functions).