added color encoding for leaves, toggle swtich