Make implementation match documentation

Use map instead of set