Press flag to see sorting algorithm in action.
@Zro716 's script helped me a little bit. Had to do some debugging.