Added code for creating a priority tree based on frequency data