finished spt coding - not tested