refactoring facebook connect