A better way would be to make Celestia more general in the future to allow all kind of databases. There is always a balance between versatility, complexity and effectivity of the code one has to consider, of course.
Since you already completed step 1, what is the rms error of your fit? That is, if you apply your function to the Hipparcos data, what distance error do you get, in general (comparing to the distances from "true" measured Hipparcos parallaxes)? Since there is an intrinsic spread in the data, I should caution you that there is a risk of over-fitting the data with a too-many-parameters fit (that is: don't use higher degree polynomials than you find necessary).
Keep up the good work!

/Alexis