Add rule and rule cleanup, fix double cleaning in older bashes