add external cart2sph function