Added factory and tests.