Document and clean up the to_*() helper functions