Added code for generating ps code