Lots of string mallocs and copies replaced with strdup.