cleaned up PS1 and added hg support