remove the unsafe and unportable snprintf and a few other minors