reverse dict to prevent clobbering of data when rank is equal
rename test/ to tests/
add README.md
refactor the tests a bit to make them more readable