Refactor rules layout to avoid duplication