improved friendcounter

contains 27adae2 and c927626