add db and finish match structure