Added functionality to allow sorting