Fixed strcat/strcpy, added reallocs and offset calculation