refactored facebook api call