Refactoring to modulai