refactoring helper functions into util file and finishing get friends call