removed unnecessary function; calling free() now