Restructured code and tests.
Added some benchmarks.