function which order elements