added source code and tests.