Added derivation of refraction.