Improved PS1 code.