Refactor buyPack