Add center finding funtion