Add test; use BiMap in implementation.