Completed cleaning up of query, so that multiple queries can be handled
through GUI, BFS is not throwing errors (even though it still doesn't
work as of yet), and Rabin-Karp does not work yet