Refactored according to the new design (see the Architecture class diagram)