added automatic peak finding to centering alg