working buildDeck function