Refactored code in populate_deck method