private int calculateNewDelay()
    {
        //core.setMessageDelay((long)(500/(1+500*Math.pow(2, messagesQueue.size() * 2))));
        return (int)(500/(1+500*Math.pow(2, messagesQueue.size() * 2)));
    }