Ported to Spark Core