Adds tests for keyvalue
Fixes hashing function and adds some tests to it