Refacotring app download functionality