Some refactoring of architecture.