Made function for Saving PMA
Reorganized code; Removed a few try catch exceptions