create rule and cleanup