The QueryStatement object model is obsolete, and confusing. Think on how to bring together the low level query representation with the high level representation.
It is not the focus of this task to create a programmatic query model, only to clean up the existing one.