moved code into saps()