Paper version. Added additional tests and microbenchmarks.