refactor the pcs.py to give a more friendy and gental code