added derivation for ppi; lots of other stuff too