Refactoring to use new architecture