rules ui refactoring + some fixes

I think it would be useful to have this function public (I had to copy it's source for the presentation tree)