Refactored PS1 generator function. Added rev mark when ahead.