Refactoring.

- Get rid of factories.
- Use constructor dependency injection instead.