Code for spark class