refactoring buy