modify order and template function