build deck function