sorting works and turns on and off