Improve PS code