building the database