         print("Authenticating local user...")
         if GKLocalPlayer.localPlayer().authenticated == false {
             GKLocalPlayer.localPlayer().authenticateHandler = { (view, error) in
-                if error == nil {
-                    self.authenticated = true
-                } else {
-                    print("\(error?.localizedDescription)")
+                guard error == nil else {
+                    print("Authentication error: \(error?.localizedDescription)")
+                    return
                 }
+                
+                self.authenticated = true
             }
         } else {
             print("Already authenticated")

        let playerIDs = match.players.map { $0.playerID } as! [String]
        
        GKPlayer.loadPlayersForIdentifiers(playerIDs) { (players, error) -> Void in
            if error != nil {
                print("Error retrieving player info: \(error!.localizedDescription)")
                self.matchStarted = false
                self.delegate?.matchEnded()
            } else {
                guard let players = players else {
                    print("Error retrieving players; returned nil")
                    return
                }
                
                for player in players {
                    print("Found player: \(player.alias)")
                    self.playersDict[player.playerID!] = player
                }
                
                self.matchStarted = true
                GKMatchmaker.sharedMatchmaker().finishMatchmakingForMatch(self.match)
                self.delegate?.matchStarted()
            }
        }
    }
    

    /// The match object provided by GameKit.
    public var match: GKMatch!
    
    private var achievements = [String: GKAchievement]()
    private weak var delegate: GCHelperDelegate?
    private var invite: GKInvite!
    private var invitedPlayer: GKPlayer!
    private var playersDict = [String: AnyObject]()
    private weak var presentingViewController: UIViewController!
    
    private var authenticated = false
    private var matchStarted = false
    
    /// The shared instance of GCHelper, allowing you to access the same instance across all uses of the library.
    public class var sharedInstance: GCHelper {
