beta version of working threshold scanner with new method. Ordering of mpas broken, probably due to memory allocation