improvement on the evaluation algorithm