some optimization

move constants MAX... into class
speedup eval