separated the references query out