Refactoring to support routing.