Similar to my previous comment, is this code really specific to WGS84?  Or will it work with other ellipsoids?