Added factory interfaces.
Fixed tests.