add sorting to template feature