Further work on the mass scan

Code stll only tested with the QMG420, massive amounts of minor
problems with the QMG422 code must be expected