Refactoring of query handling to support collection joins
Further work on queries
Added element match query support
Added element match support
Minor
Further work on queries