Added some changes for Spark