Added sort funtionality