added database, started match logic