updated ps with new algorithm