diff --git a/clocks.c b/clocks.c
index 5cdc8d5..81da6c3 100644
--- a/clocks.c
+++ b/clocks.c
@@ -81,8 +81,27 @@
 	return atoi(result);
 }
 
+void find_parents_for_clock(char *clkname, int complete)
+{
+	char name[256];
+
+	name[0] = '\0';
+	if (!complete) {
+		char str[256];
+
+		strcat(name, clkname);
+		sprintf(str, "Enter Clock Name : %s\n", name);
+		print_one_clock(2, str, 1, 0);
+		return;
+	}
+	sprintf(name, "Parents for \"%s\" Clock : \n", clkname);
+	print_one_clock(0, name, 1, 1);
+	dump_all_parents(clkname);
+} 
+
 int read_and_print_clock_info(int verbose, int hrow, int selected)
 {
+	print_one_clock(0, "Reading Clock Tree ...", 1, 1);
 	if (!old_clock_line_no)
 		read_clock_info(clk_dir_path);
 
@@ -234,8 +253,7 @@
 
 void read_and_dump_clock_info_one(char *clk)
 {
-	printf("Clock Tree : (clock name = %s)\n", clk);
-	printf("**********\n");
+	printf("\nParents for \"%s\" Clock :\n\n", clk);
 	read_clock_info(clk_dir_path);
 	dump_all_parents(clk);
 }
@@ -365,14 +383,19 @@
 	(*parent)->num_children++;
 }
 
-void dump_parent(struct clock_info *clk)
+void dump_parent(struct clock_info *clk, int line)
 {
 	char *unit = "Hz";
 	double drate;
-	static char spaces[256];
+	static char spaces[64];
+	char str[256];
+	static int maxline;
+
+	if (maxline < line)
+		maxline = line;
 		
 	if (clk && clk->parent)
-		dump_parent(clk->parent);
+		dump_parent(clk->parent, ++line);
 
  	drate = (double)clk->rate;
 	if (drate > 1000 && drate < 1000000) {
@@ -384,15 +407,23 @@
 		drate /= 1000000;
 	}
 	if (clk == clocks_info) {
+		line++;
 		strcpy(spaces, "");
-		printf("%s%s (flags:%d,usecount:%d,rate:%5.2f %s)\n", spaces,
-			clk->name, clk->flags, clk->usecount, drate, unit);
+		sprintf(str, "%s%s (flags:%d,usecount:%d,rate:%5.2f %s)\n",
+			spaces, clk->name, clk->flags, clk->usecount, drate,
+			unit);
 	} else {
 		if (!(clk->parent == clocks_info))
 			strcat(spaces, "  ");
-		printf("%s`- %s (flags:%d,usecount:%d,rate:%5.2f %s)\n", spaces,
-			clk->name, clk->flags, clk->usecount, drate, unit);
+		sprintf(str, "%s`- %s (flags:%d,usecount:%d,rate:%5.2f %s)\n",
+			spaces, clk->name, clk->flags, clk->usecount, drate,
+			unit);
 	}
+	if (dump)
+		//printf("line=%d:m%d:l%d %s", maxline - line + 2, maxline, line, str);
+		printf("%s", str);
+	else
+		print_one_clock(maxline - line + 2, str, 1, 0);
 }
 
 void dump_all_parents(char *clkarg)
@@ -414,7 +445,7 @@
 //			printf("%s <-- ", spaces);
 //		}
 //		printf("  /\n");
-		dump_parent(clk);
+		dump_parent(clk, 1);
 	}
 }
 
diff --git a/powerdebug.c b/powerdebug.c
index 439f8f2..14748c5 100644
--- a/powerdebug.c
+++ b/powerdebug.c
@@ -216,9 +216,9 @@
 {
 	int c, i;
 	int firsttime[TOTAL_FEATURE_WINS];
-	int enter_hit = 0, verbose = 0;
+	int enter_hit = 0, verbose = 0, findparent_ncurses = 0;
 	int regulators = 0, sensors = 0, clocks = 0, findparent = 0;
-	char clkarg[64];
+	char clkarg[64], clkname_str[64];
 
 	for (i = 0; i < TOTAL_FEATURE_WINS; i++)
 		firsttime[i] = 1;
@@ -343,16 +343,22 @@
 				ret = init_clock_details();
 				if (!ret)
 					firsttime[CLOCK] = 0;
+				strcpy(clkname_str, "");
 			}
 			if (!ret && !dump) {
 				int hrow;
 
 				create_selectedwindow();
-				hrow = read_and_print_clock_info(verbose,
+				if (!findparent_ncurses) {
+					hrow = read_and_print_clock_info(
+								verbose,
 								highlighted_row,
 								enter_hit);
-				highlighted_row = hrow;
-				enter_hit = 0;
+					highlighted_row = hrow;
+					enter_hit = 0;
+				} else
+					find_parents_for_clock(clkname_str,
+								enter_hit);
 			}
 			if (!ret && dump) {
 				if (findparent)
@@ -383,6 +389,7 @@
 		if (key)  {
 			char keychar;
 			int keystroke = getch();
+			int oldselectedwin = selectedwindow;
 
 			if (keystroke == EOF)
 				exit(0);
@@ -404,18 +411,49 @@
 					highlighted_row++;
 				if (keystroke == KEY_UP && highlighted_row > 0)
 					highlighted_row--;
+				if (keystroke == 47)
+					findparent_ncurses = 1;
+
+				if ((keystroke == 27 || oldselectedwin !=
+					selectedwindow) && findparent_ncurses) {
+					findparent_ncurses = 0;
+					clkname_str[0] = '\0';
+				}
+
+				if (findparent_ncurses && keystroke != 13) {
+					int len = strlen(clkname_str);
+					char str[2];
+
+					if (keystroke == 263) {
+						if (len > 0)
+							len--;
+
+						clkname_str[len] = '\0';
+					} else {
+						if (strlen(clkname_str) ||
+							keystroke != '/') {
+						str[0] = keystroke;
+						str[1] = '\0';
+						if (len < 63)
+							strcat(clkname_str,
+								str);
+						}
+					}
+				}
 			}
 
 			keychar = toupper(keystroke);
-
-			//killall_windows(1); fini_curses();
-			//printf("key entered %d:%c\n", keystroke, keychar);
-			//exit(1);
+//#define DEBUG
+#ifdef DEBUG
+			killall_windows(1); fini_curses();
+			printf("key entered %d:%c\n", keystroke, keychar);
+			exit(1);
+#endif
 
 			if (keystroke == 13)
 				enter_hit = 1;
 
-			if (keychar == 'Q')
+			if (keychar == 'Q' && !findparent_ncurses)
 				exit(0);
 			if (keychar == 'R')
 				ticktime = 3;
diff --git a/powerdebug.h b/powerdebug.h
index d07849d..4799118 100644
--- a/powerdebug.h
+++ b/powerdebug.h
@@ -62,6 +62,7 @@
 						struct clock_info *parent);
 extern void dump_clock_info(struct clock_info *clk, int level, int bmp);
 extern void insert_children(struct clock_info **parent, struct clock_info *clk);
+extern void find_parents_for_clock(char *clkname, int complete);
 extern int  read_and_print_clock_info(int verbose, int hrow, int selected);
 extern void print_clock_info(int verbose, int hrow, int selected);
 extern void get_sensor_info(char *path, char *name, char *sensor, int verbose);
