Spark rewritten