Cleaning up some code, removing unnessecary mallocs, adding in return values in some places, adding out of mem error
Removing more mallocs in favor of stack arrays for fixed sized buffers. adding more return codes where they were missed. checking for OOM