Mechanisms of the Effect of Dopants and P(O2) on the Improper Ferroelastic Phase Transition in SrTiO3