ranj - take DB and NextMatch