modified function evaluate()