just adding some comments
had no idea strdup wasn't a standard c function