Add working version and tests.