public function addCallbacks($name, array $events, array $users = []) {
        // Default priority
        $defaultPriority = 0;

        foreach ($events as $event => $callback) {
            if (!isset($this->callbacks[$event])) {
                // Create a priority queue for this event
                $this->callbacks[$event] = new PriorityQueue();
            }

            if (is_string($callback)) {
                // 'eventName' => 'someMethod'
                $this->callbacks[$event]->insert([
                    'handler' => $name,
                    'method' => $callback,
                    'users' => $users,
                ], $defaultPriority);
            } else if (is_array($callback)) {
                // 'eventName' => [ ... ]
                foreach ($callback as $method => $priority) {
                    if (is_int($method)) {
                        // 'eventName' => ['someMethod', ...]
                        $method = $priority;
                        $priority = $defaultPriority;
                    }

                    $this->callbacks[$event]->insert([
                        'handler' => $name,
                        'method' => $method,
                        'users' => $users,
                    ], $priority);
                }
            } else if (is_int($callback)) {
                // We have a closure as a callback, so $callback is the actual priority
                $this->callbacks[$event]->insert([
                    'handler' => $name,
                    'users' => $users,
                ], $callback);
            } else {
                throw new InvalidArgumentException('Invalid event definition for listener: ' . $name, 500);
            }
        }

        return $this;
    }