Moved spark core code over from playground