refactor for exercise