refactor for modularity