refactored code for ns naming, more expressive rule fomat, more clear
rule interchange formats for internal functions