rewrite evaluation logic