Finish a rough implementation and partial tests.