some comments and removed a redundant query