Added some comments, changing some variable names, empty query response validation and other minor fixes