Fixed evaluator to handle factors