Clean up and renaming to make Spark happy