friends.js refactored;