refactor for simplicity