Add library code and tests.