passing in pointers to add and append. added error comments.