Updated detector. Lines for plotting commented out.