move sortElements in included js file