merged add functions, improved error messages