[SPARK-1766] sorted functions to meet pedantic requirements