Hash-based version. Unfinished. Do not try to compile.