api friend handling tested, fixed and documented