building up the database