Refactor friend checking