Refactor define to defineRule