adapted for latest D2 java api