Getting sort working