Added test scan code, but does not work currently due to a bug in the fine tuning code.