use polymorphism to improve handleOperator