Refactored module structure to make it clearer.