template feature updated,

selection sorting optimized.