Take away sort function to see if that is creating error