Refactored friend handling into separate class