most rules are now wrapped in "inRule". this is preparation for better
and more consistent error reporting and exception handling.
Improved some visibilities.