Added new method sort
added template for sort