refactoring checkout