JC-1740 Fixed adding contacts. Added tests and comments.