revised to Spark 1.0.2