Updated for compatibility with the Spark Core.