Refactored the architecture