Changing exits to PMA::app()->end();