improved rulesCompile