diff --git a/create_sample_databases.py b/create_sample_databases.py
index 0cc49d3a64f7d21e062eeebd8fdbedecd0eeca12..1b73b61d80a2ce83d13d279bb938434878d2334f 100644
--- a/create_sample_databases.py
+++ b/create_sample_databases.py
@@ -5,64 +5,64 @@ from queryprocessing import *
 
 # A simple class to keep track of the set of relations and indexes created together
 class Database:
-    def __init__(self, name):
-        self.name = name
-        self.relations = dict()
-        self.indexes = dict()
-    def newRelation(self, relname, rel_schema):
-        self.relations[relname] = Relation(relname, rel_schema)
-        return self.relations[relname]
-    def getRelation(self, relname):
-        return self.relations[relname]
-    def newIndex(self, relname, attribute, keysize):
-        self.indexes[(relname, attribute)] = BTreeIndex(keysize = keysize, relation = self.getRelation(relname), attribute = attribute)
-        return self.indexes[(relname, attribute)]
-    def getIndex(self, relname, attribute):
-        return self.indexes[(relname, attribute)]
+	def __init__(self, name):
+		self.name = name
+		self.relations = dict()
+		self.indexes = dict()
+	def newRelation(self, relname, rel_schema):
+		self.relations[relname] = Relation(relname, rel_schema)
+		return self.relations[relname]
+	def getRelation(self, relname):
+		return self.relations[relname]
+	def newIndex(self, relname, attribute, keysize):
+		self.indexes[(relname, attribute)] = BTreeIndex(keysize = keysize, relation = self.getRelation(relname), attribute = attribute)
+		return self.indexes[(relname, attribute)]
+	def getIndex(self, relname, attribute):
+		return self.indexes[(relname, attribute)]
 
 def createDatabase1(name):
-    ## Let's first create a relation with a bunch of tuples 
-    db = Database(name)
-    instr_schema = ["ID", "name", "dept_name", "salary", "building"]
-    instructor = db.newRelation("instructor", instr_schema)
-    instructor.insertTuple(Tuple(instr_schema, ('10101', 'Srinivasan', 'Comp. Sci.', '65000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('12121', 'Wu', 'Finance', '90000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('15151', 'Mozart', 'Music', '40000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('22222', 'Einstein', 'Physics', '95000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('32343', 'El Said', 'History', '60000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('33456', 'Gold', 'Physics', '87000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('58583', 'Califieri', 'History', '62000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('76543', 'Singh', 'Finance', '80000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('76766', 'Crick', 'Biology', '72000', 'Watson')));
-    instructor.insertTuple(Tuple(instr_schema, ('83821', 'Brandt', 'Comp. Sci.', '92000', 'Iribe')));
-    instructor.insertTuple(Tuple(instr_schema, ('98345', 'Kim', 'Elec. Eng.', '80000', 'Iribe')));
+	## Let's first create a relation with a bunch of tuples 
+	db = Database(name)
+	instr_schema = ["ID", "name", "dept_name", "salary", "building"]
+	instructor = db.newRelation("instructor", instr_schema)
+	instructor.insertTuple(Tuple(instr_schema, ('10101', 'Srinivasan', 'Comp. Sci.', '65000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('12121', 'Wu', 'Finance', '90000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('15151', 'Mozart', 'Music', '40000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('22222', 'Einstein', 'Physics', '95000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('32343', 'El Said', 'History', '60000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('33456', 'Gold', 'Physics', '87000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('58583', 'Califieri', 'History', '62000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('76543', 'Singh', 'Finance', '80000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('76766', 'Crick', 'Biology', '72000', 'Watson')));
+	instructor.insertTuple(Tuple(instr_schema, ('83821', 'Brandt', 'Comp. Sci.', '92000', 'Iribe')));
+	instructor.insertTuple(Tuple(instr_schema, ('98345', 'Kim', 'Elec. Eng.', '80000', 'Iribe')));
 
-    dept_schema = ["dept_name", "building", "budget"]
-    department = db.newRelation("department", dept_schema)
-    department.insertTuple(Tuple(dept_schema, ('Biology', 'Watson', '90000')));
-    department.insertTuple(Tuple(dept_schema, ('Ca is after bio but before comp sci', 'Watson', '90000')));
-    department.insertTuple(Tuple(dept_schema, ('Comp. Sci.', 'Iribe', '100000')));
-    department.insertTuple(Tuple(dept_schema, ('Elec. Eng.', 'Iribe', '85000')));
-    department.insertTuple(Tuple(dept_schema, ('Finance', 'Painter', '120000')));
-    department.insertTuple(Tuple(dept_schema, ('History', 'Painter', '50000')));
-    department.insertTuple(Tuple(dept_schema, ('Music', 'Packard', '80000')));
-    department.insertTuple(Tuple(dept_schema, ('Physics', 'Watson', '70000')));
+	dept_schema = ["dept_name", "building", "budget"]
+	department = db.newRelation("department", dept_schema)
+	department.insertTuple(Tuple(dept_schema, ('Biology', 'Watson', '90000')));
+	department.insertTuple(Tuple(dept_schema, ('Ca is after bio but before comp sci', 'Watson', '90000')));
+	department.insertTuple(Tuple(dept_schema, ('Comp. Sci.', 'Iribe', '100000')));
+	department.insertTuple(Tuple(dept_schema, ('Elec. Eng.', 'Iribe', '85000')));
+	department.insertTuple(Tuple(dept_schema, ('Finance', 'Painter', '120000')));
+	department.insertTuple(Tuple(dept_schema, ('History', 'Painter', '50000')));
+	department.insertTuple(Tuple(dept_schema, ('Music', 'Packard', '80000')));
+	department.insertTuple(Tuple(dept_schema, ('Physics', 'Watson', '70000')));
 
-    instructor2 = db.newRelation("instructor_2", instr_schema)
-    instructor2.insertTuple(Tuple(instr_schema, ('10101', 'Srinivasan', 'Comp. Sci.', '65000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('12121', 'Wu', 'Finance', '90000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('58583', 'Califieri', 'History', '62000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('76543', 'Singh', 'Finance', '80000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('76766', 'Crick', 'Biology', '72000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('83821', 'Brandt', 'Comp. Sci.', '92000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('98345', 'Kim', 'Elec. Eng.', '80000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('34322', 'Davis', 'Finance', '92000')));
-    instructor2.insertTuple(Tuple(instr_schema, ('51769', 'Gray', 'Elec. Eng.', '80000')));
+	instructor2 = db.newRelation("instructor_2", instr_schema)
+	instructor2.insertTuple(Tuple(instr_schema, ('10101', 'Srinivasan', 'Comp. Sci.', '65000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('12121', 'Wu', 'Finance', '90000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('58583', 'Califieri', 'History', '62000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('76543', 'Singh', 'Finance', '80000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('76766', 'Crick', 'Biology', '72000', 'Watson')));
+	instructor2.insertTuple(Tuple(instr_schema, ('83821', 'Brandt', 'Comp. Sci.', '92000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('98345', 'Kim', 'Elec. Eng.', '80000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('34322', 'Davis', 'Finance', '92000', 'Iribe')));
+	instructor2.insertTuple(Tuple(instr_schema, ('51769', 'Gray', 'Elec. Eng.', '80000', 'Iribe')));
 
-    # With the given settings, the following B+-Tree is identical to the one shown in
-    # Figure 11.9 in the textbook
-    db.newIndex(keysize = 20, relname = "instructor", attribute = "name")
-    #db.newIndex(keysize = 20, relname = "instructor", attribute = "dept_name")
+	# With the given settings, the following B+-Tree is identical to the one shown in
+	# Figure 11.9 in the textbook
+	db.newIndex(keysize = 20, relname = "instructor", attribute = "name")
+	#db.newIndex(keysize = 20, relname = "instructor", attribute = "dept_name")
 
-    return db
+	return db
diff --git a/outputBtree.txt b/outputBtree.txt
new file mode 100644
index 0000000000000000000000000000000000000000..339fe33c669ec9d6257bd0fc2d40ee4eb44b447b
--- /dev/null
+++ b/outputBtree.txt
@@ -0,0 +1,85 @@
+================================================================================
+Relation instructor contains 6 blocks
+Block No. 0, Type: RelationBlock: ('10101', 'Srinivasan', 'Comp. Sci.', '65000', 'Iribe'), ('12121', 'Wu', 'Finance', '90000', 'Iribe')
+Block No. 1, Type: RelationBlock: ('15151', 'Mozart', 'Music', '40000', 'Iribe'), ('22222', 'Einstein', 'Physics', '95000', 'Iribe')
+Block No. 2, Type: RelationBlock: ('32343', 'El Said', 'History', '60000', 'Iribe'), ('33456', 'Gold', 'Physics', '87000', 'Iribe')
+Block No. 3, Type: RelationBlock: ('45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe'), ('58583', 'Califieri', 'History', '62000', 'Iribe')
+Block No. 4, Type: RelationBlock: ('76543', 'Singh', 'Finance', '80000', 'Iribe'), ('76766', 'Crick', 'Biology', '72000', 'Watson')
+Block No. 5, Type: RelationBlock: ('83821', 'Brandt', 'Comp. Sci.', '92000', 'Iribe'), ('98345', 'Kim', 'Elec. Eng.', '80000', 'Iribe')
+================================================================================
+Relation department contains 3 blocks
+Block No. 6, Type: RelationBlock: ('Biology', 'Watson', '90000'), ('Ca is after bio but before comp sci', 'Watson', '90000'), ('Comp. Sci.', 'Iribe', '100000')
+Block No. 7, Type: RelationBlock: ('Elec. Eng.', 'Iribe', '85000'), ('Finance', 'Painter', '120000'), ('History', 'Painter', '50000')
+Block No. 8, Type: RelationBlock: ('Music', 'Packard', '80000'), ('Physics', 'Watson', '70000'), None
+================================================================================
+Printing BTree Index on Relation instructor on Attribute name
+--- Level 0 (root): 
+	Block No. 21, Type: BTree, Parent: None: {Block 16}, Mozart, {Block 20}
+--- Level 1: 
+	Block No. 16, max 7, Type: BTree, Parent: 21: {Block 14}, Einstein, {Block 19}, Gold, {Block 17}
+	Block No. 20, max 7, Type: BTree, Parent: 21: {Block 18}, Srinivasan, {Block 15}
+--- Level 2: 
+	Block No. 14, max 7, Type: BTree, Parent: 16: {Block 5, Tuple 0}, Brandt, {Block 3, Tuple 1}, Califieri, {Block 4, Tuple 1}, Crick, {Block 19}
+	Block No. 19, max 7, Type: BTree, Parent: 16: {Block 1, Tuple 1}, Einstein, {Block 2, Tuple 0}, El Said, {Block 17}
+	Block No. 17, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 1}, Gold, {Block 3, Tuple 0}, Katz, {Block 5, Tuple 1}, Kim, {Block 18}
+	Block No. 18, max 7, Type: BTree, Parent: 20: {Block 1, Tuple 0}, Mozart, {Block 4, Tuple 0}, Singh, {Block 15}
+	Block No. 15, max 7, Type: BTree, Parent: 20: {Block 0, Tuple 0}, Srinivasan, {Block 0, Tuple 1}, Wu, None
+================================================================================
+Searching for all instructors with names starting with M to R
+Retrieving Block No. 21, Type: BTree, Parent: None: {Block 16}, Mozart, {Block 20}
+Retrieving Block No. 16, max 7, Type: BTree, Parent: 21: {Block 14}, Einstein, {Block 19}, Gold, {Block 17}
+Retrieving Block No. 17, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 1}, Gold, {Block 3, Tuple 0}, Katz, {Block 5, Tuple 1}, Kim, {Block 18}
+Retrieving Block No. 18, max 7, Type: BTree, Parent: 20: {Block 1, Tuple 0}, Mozart, {Block 4, Tuple 0}, Singh, {Block 15}
+Retrieving Block No. 1, Type: RelationBlock: ('15151', 'Mozart', 'Music', '40000', 'Iribe'), ('22222', 'Einstein', 'Physics', '95000', 'Iribe')
+Results: ('15151', 'Mozart', 'Music', '40000', 'Iribe')
+================================================================================
+Deleting the entry for key Mozart
+Block No. 20, max 7, Type: BTree, Parent: 21: {Block 18}, Srinivasan, {Block 15}
+** 0 - 18 - 18
+Block No. 21, Type: BTree, Parent: None: {Block 16}, Mozart, {Block 20}
+** 0 - 16 - 20
+** 2 - 20 - 20
+================================================================================
+Printing BTree Index on Relation instructor on Attribute name
+--- Level 0 (root): 
+	Block No. 16, Type: BTree, Parent: None: {Block 14}, Einstein, {Block 19}, Gold, {Block 17}, Mozart, {Block 18}
+--- Level 1: 
+	Block No. 14, max 7, Type: BTree, Parent: 16: {Block 5, Tuple 0}, Brandt, {Block 3, Tuple 1}, Califieri, {Block 4, Tuple 1}, Crick, {Block 19}
+	Block No. 19, max 7, Type: BTree, Parent: 16: {Block 1, Tuple 1}, Einstein, {Block 2, Tuple 0}, El Said, {Block 17}
+	Block No. 17, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 1}, Gold, {Block 3, Tuple 0}, Katz, {Block 5, Tuple 1}, Kim, {Block 18}
+	Block No. 18, max 7, Type: BTree, Parent: 16: {Block 4, Tuple 0}, Singh, {Block 0, Tuple 0}, Srinivasan, {Block 0, Tuple 1}, Wu, None
+================================================================================
+Printing BTree Index on Relation instructor on Attribute name
+--- Level 0 (root): 
+	Block No. 16, Type: BTree, Parent: None: {Block 14}, Einstein, {Block 19}, Gold, {Block 17}, Mozart, {Block 18}
+--- Level 1: 
+	Block No. 14, max 7, Type: BTree, Parent: 16: {Block 5, Tuple 0}, Brandt, {Block 3, Tuple 1}, Califieri, {Block 4, Tuple 1}, Crick, {Block 19}
+	Block No. 19, max 7, Type: BTree, Parent: 16: {Block 1, Tuple 1}, Einstein, {Block 2, Tuple 0}, El Said, {Block 17}
+	Block No. 17, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 1}, Gold, {Block 3, Tuple 0}, Katz, {Block 5, Tuple 1}, Kim, {Block 18}
+	Block No. 18, max 7, Type: BTree, Parent: 16: {Block 4, Tuple 0}, Singh, {Block 0, Tuple 0}, Srinivasan, {Block 0, Tuple 1}, Wu, None
+================================================================================
+Deleting the entry for key Einstein
+Block No. 16, Type: BTree, Parent: None: {Block 14}, Einstein, {Block 19}, Gold, {Block 17}, Mozart, {Block 18}
+** 0 - 14 - 19
+** 2 - 19 - 19
+Redistributing entries between Block No. 14, max 7, Type: BTree, Parent: 16: {Block 5, Tuple 0}, Brandt, {Block 3, Tuple 1}, Califieri, {Block 4, Tuple 1}, Crick, {Block 19} and Block No. 19, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 0}, El Said, {Block 17}
+CASE OTHER UNDERFULL, LEAF
+
+================================================================================
+Printing BTree Index on Relation instructor on Attribute name
+--- Level 0 (root): 
+	Block No. 16, Type: BTree, Parent: None: {Block 14}, Crick, {Block 19}, Gold, {Block 17}, Mozart, {Block 18}
+--- Level 1: 
+	Block No. 14, max 7, Type: BTree, Parent: 16: {Block 5, Tuple 0}, Brandt, {Block 3, Tuple 1}, Califieri, {Block 19}
+	Block No. 19, max 7, Type: BTree, Parent: 16: {Block 4, Tuple 1}, Crick, {Block 2, Tuple 0}, El Said, {Block 17}
+	Block No. 17, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 1}, Gold, {Block 3, Tuple 0}, Katz, {Block 5, Tuple 1}, Kim, {Block 18}
+	Block No. 18, max 7, Type: BTree, Parent: 16: {Block 4, Tuple 0}, Singh, {Block 0, Tuple 0}, Srinivasan, {Block 0, Tuple 1}, Wu, None
+================================================================================
+Printing BTree Index on Relation instructor on Attribute name
+--- Level 0 (root): 
+	Block No. 16, Type: BTree, Parent: None: {Block 14}, Crick, {Block 19}, Gold, {Block 17}, Mozart, {Block 18}
+--- Level 1: 
+	Block No. 14, max 7, Type: BTree, Parent: 16: {Block 5, Tuple 0}, Brandt, {Block 3, Tuple 1}, Califieri, {Block 19}
+	Block No. 19, max 7, Type: BTree, Parent: 16: {Block 4, Tuple 1}, Crick, {Block 2, Tuple 0}, El Said, {Block 17}
+	Block No. 17, max 7, Type: BTree, Parent: 16: {Block 2, Tuple 1}, Gold, {Block 3, Tuple 0}, Katz, {Block 5, Tuple 1}, Kim, {Block 18}
+	Block No. 18, max 7, Type: BTree, Parent: 16: {Block 4, Tuple 0}, Singh, {Block 0, Tuple 0}, Srinivasan, {Block 0, Tuple 1}, Wu, None
diff --git a/outputQueryprocessing.txt b/outputQueryprocessing.txt
new file mode 100644
index 0000000000000000000000000000000000000000..990e5f1ab42231f4892fb61a2c6fe63e5dabd249
--- /dev/null
+++ b/outputQueryprocessing.txt
@@ -0,0 +1,55 @@
+================================================================================
+Relation instructor contains 6 blocks
+Block No. 0, Type: RelationBlock: ('10101', 'Srinivasan', 'Comp. Sci.', '65000', 'Iribe'), ('12121', 'Wu', 'Finance', '90000', 'Iribe')
+Block No. 1, Type: RelationBlock: ('15151', 'Mozart', 'Music', '40000', 'Iribe'), ('22222', 'Einstein', 'Physics', '95000', 'Iribe')
+Block No. 2, Type: RelationBlock: ('32343', 'El Said', 'History', '60000', 'Iribe'), ('33456', 'Gold', 'Physics', '87000', 'Iribe')
+Block No. 3, Type: RelationBlock: ('45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe'), ('58583', 'Califieri', 'History', '62000', 'Iribe')
+Block No. 4, Type: RelationBlock: ('76543', 'Singh', 'Finance', '80000', 'Iribe'), ('76766', 'Crick', 'Biology', '72000', 'Watson')
+Block No. 5, Type: RelationBlock: ('83821', 'Brandt', 'Comp. Sci.', '92000', 'Iribe'), ('98345', 'Kim', 'Elec. Eng.', '80000', 'Iribe')
+================================================================================
+Relation department contains 3 blocks
+Block No. 6, Type: RelationBlock: ('Biology', 'Watson', '90000'), ('Ca is after bio but before comp sci', 'Watson', '90000'), ('Comp. Sci.', 'Iribe', '100000')
+Block No. 7, Type: RelationBlock: ('Elec. Eng.', 'Iribe', '85000'), ('Finance', 'Painter', '120000'), ('History', 'Painter', '50000')
+Block No. 8, Type: RelationBlock: ('Music', 'Packard', '80000'), ('Physics', 'Watson', '70000'), None
+==================== Executing A Natural Join ================
+---> ['10101', 'Srinivasan', 'Comp. Sci.', '65000', 'Iribe', '100000']
+---> ['45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe', '100000']
+---> ['76766', 'Crick', 'Biology', '72000', 'Watson', '90000']
+---> ['83821', 'Brandt', 'Comp. Sci.', '92000', 'Iribe', '100000']
+---> ['98345', 'Kim', 'Elec. Eng.', '80000', 'Iribe', '85000']
+==================== Executing A Groupby Aggregate Query ================
+---> ('Biology', 72000.0)
+---> ('Finance', 85000.0)
+---> ('Elec. Eng.', 80000.0)
+---> ('Music', 40000.0)
+---> ('Comp. Sci.', 77333.33333333333)
+---> ('Physics', 91000.0)
+---> ('History', 61000.0)
+==================== Executing A Groupby Aggregate Query ================
+---> ('Biology', '72000')
+---> ('Finance', '90000')
+---> ('Elec. Eng.', '80000')
+---> ('Music', '40000')
+---> ('Comp. Sci.', '75000')
+---> ('Physics', '95000')
+---> ('History', '62000')
+==================== Executing A Groupby Aggregate Query ================
+---> ('Biology', '72000')
+---> ('Finance', '90000')
+---> ('Elec. Eng.', '80000')
+---> ('Music', '40000')
+---> ('Comp. Sci.', '65000')
+---> ('Physics', '87000')
+---> ('History', '60000')
+==================== Executing A Set Minus Operation ================
+---> ('15151', 'Mozart', 'Music', '40000', 'Iribe')
+---> ('22222', 'Einstein', 'Physics', '95000', 'Iribe')
+---> ('32343', 'El Said', 'History', '60000', 'Iribe')
+---> ('33456', 'Gold', 'Physics', '87000', 'Iribe')
+---> ('45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe')
+==================== Executing A Set Minus Operation ================
+---> ['15151', 'Mozart', 'Music', '40000', 'Iribe']
+---> ['22222', 'Einstein', 'Physics', '95000', 'Iribe']
+---> ['32343', 'El Said', 'History', '60000', 'Iribe']
+---> ['33456', 'Gold', 'Physics', '87000', 'Iribe']
+---> ['45565', 'Katz', 'Comp. Sci.', '75000', 'Iribe']
diff --git a/testing-queryprocessing.py b/testing-queryprocessing.py
index 7ae8254f58b1425cb7defb92f5d374112fd39c88..8ce3282174222851c1c0ec7bfea0fe568f5b3563 100644
--- a/testing-queryprocessing.py
+++ b/testing-queryprocessing.py
@@ -67,13 +67,6 @@ def query5():
 	for t in aggr.get_next():
 		print("---> " + str(t))
 
-# The following operators work
-#query1()
-#query1a()
-#query2()
-#query3()
-query4()
-#query5()
 
 # Natural join
 def query6a():
@@ -85,8 +78,6 @@ def query6a():
 	for t in j.get_next():
 		print("---> " + str(t))
 
-query6a()
-
 def query6():
 	scan1 = SequentialScan(db1.getRelation("instructor"))
 	scan2 = SequentialScan(db1.getRelation("department"))
@@ -96,7 +87,6 @@ def query6():
 	for t in j.get_next():
 		print("---> " + str(t))
 
-query6()
 
 # Trying to execute a group by aggregate
 def query7a():
@@ -142,4 +132,20 @@ def query8b():
 	for t in sm.get_next():
 		print("---> " + str(t))
 
-#query8b()
+# The following operators work
+
+#query1()
+#query1a()
+#query2()
+#query3()
+#query4()
+#query5()
+
+query6()
+query7a()
+query7b()
+query7c()
+query8a()
+query8b()
+
+