changed containers to use realloc