Refactor for modularity.