Sorting and karma script change