middleware added to compute the number of queries to the database
minor changes