updated str_struct to be simpler to use

also fixed memory leaks