Refactored Facebook authentication