Cleaned up output. Added PH flag support.