Fixed bugs and added Spark Example and data gen...

Fixed bugs and added Spark Example and data generation