Added sort furnction for series