                 
                 self.accessToken = session.accessToken
                 
-                successHandler()
+                successHandler?()
             },
              failureHandler: { (errorResponse) in
                 print("Error while logging to SpaceDog: \(errorResponse.error?.message)")
-                failureHandler()
+                failureHandler?()
             }
         )
     }

    init() {
    }
    
    public func login(username: String, password: String, successHandler: (Void) -> Void, failureHandler: (Void) -> Void) {
        guard appName != nil else {
            print(APP_NAME_MANDATORY_ERROR)
            return

            else {
                res = Mapper<SDResponse>().map(response.result.value)
            }
            
            print("---- WS FAILURE ----")
            print("ERROR: \(res.error?.type): \(res.error?.message)")
            
            if let requestBodyData = response.request?.HTTPBody {
                do {
                    let requestJSONBody = try NSJSONSerialization.JSONObjectWithData(requestBodyData, options: .AllowFragments)
                    
                    print("REQUEST: \(response.request?.HTTPMethod) \(response.request?.URLString) with data: \(requestJSONBody)")
                } catch {}
                print("---- END -----")
            }
            
            failureHandler(res)
        }
    }
