change algorithm for determine result