working code, refactored friend model