cleanup rule generation functions