adjusted rules and code