add optimal order computation.