[Main] Refactored for modularity