Refactor for each