tighten by requiring const in parameter
fix max duplicates restriction