Added the removeQuery function, and created additional comments.