added helpful comments and added minor changes to formatting for consistancy.
added mulipurpose distance function and modified test code.
Merge pull request #11 from pmarti28/pm-refactor

Pm refactor