move SPS functions into SPS class