formatting
iflag1 has no effect
revised APD calculation