miscellaneous codes from astro stuff