adapted for spark core