Refactored to a modular design