Cleaned ps_shell code