Clean up and replacement of sprintf() -> snprintf().