Refactoring

I have cleaned up the HTML code in pmd_general.php into functions in new pmd_general.lib.php library file.