polish code and support parallel evaluation