cleanup to_string

Thanks to Arnaud D. for the review