Be consistent about variable names
Fix wrong api usage
Make test conform to documented behavior
Clean up rule management and schema translation logic