Reinstate sortElements Javascript library