Modified to handle new qtree