Significant updates to the backend query code. (v2.2.3)