added indexes to speed up the query