SPARK-3968: Code cleanup