implement SPT function