trying to imrove tracking algorithm