modified Rajiv's implementation for simplifier based on sicp class