Initial commit of old code.
Added tests.