trying to rewrite realloc