Added docs for apply_rules.