         do {
             let events = Array(eventsBuffer[0..<count])
             let json = try NSJSONSerialization.dataWithJSONObject(events.getJSONConvertible(), options: [])
-            print("MIXPANEL: Payload -> \(String(data: json, encoding: NSUTF8StringEncoding)!)")
             let base64 = json.base64EncodedStringWithOptions([]).stringByReplacingOccurrencesOfString("\n", withString: "")
             
             Alamofire.request(.GET, Mixpanel.EVENTS_ENDPOINT, parameters :

                            dispatch_semaphore_wait(self.eventsMutex, DISPATCH_TIME_FOREVER)
                            self.eventsBuffer.removeRange(0..<count)
                            dispatch_semaphore_signal(self.eventsMutex)
                            print("MIXPANEL: Sent \(count) events correctly")
                            return
                        }
                        else if let error = responseJSON["error"] as? String {
                            print("MIXPANEL ERROR: \(error)")
                        }
                    }
                }
                
                print("MIXPANEL: Error sending data or mixpanel error")
            }

        }
        catch {
            print("MIXPANEL: Error encoding events")
        }
    }
    
    private func sendBuffer() {
        guard eventsBuffer.count > 0  else {
            print("MIXPANEL: no new events, stopping process")
            stopProcessing()
            return
        }
        print("MIXPANEL: Processing events buffer")
        sendEventsBuffer()
    }
    
    private func startProcessing() {
        if self.processTimer == nil && self.timerPaused {
            print("MIXPANEL: creating a new process timer")
            self.timerPaused = false
            self.processTimer = ConcurrencyHelpers.createDispatchTimer((20 * NSEC_PER_SEC), leeway: (1 * NSEC_PER_SEC)/2, queue: opQueue, block: {
                self.sendBuffer()
            })
        }
        else if self.processTimer != nil && self.timerPaused {
            print("MIXPANEL: resuming the process timer")
            self.timerPaused = false
            dispatch_resume(self.processTimer!)
        }

            dispatch_semaphore_wait(self.eventsMutex, DISPATCH_TIME_FOREVER)
            self.eventsBuffer.appendContentsOf(mutableEvents)
            dispatch_semaphore_signal(self.eventsMutex)
            Logger.Debug("New event added to queue")
            self.startProcessing()
        }
    }
