added comments annnnnd replaced memcopy with memmove in realloc