Further adapting the library for Spark