move project statement to later so earlier queries can use index