Ported to use propose Spark library structure