Added tupple sorting, preparing for new StatAnal features.