Use TreeModel instead of going through the hashset and sort methods