Added pm function, improved GUI.