Added center finding code