moving code
making the pdf generation async