Sped up precomputed inverse code and eliminated two unneeded functions.