Detector working, just need to adjust coeffs and debug a little free corrupt