Inlined mkrules. Debugging by simplifying.
Minor renamings.