refactoring to move towards a distributed architecture