got rid of some things (malloc, free, exit) that cause errors on thorn