implementing download functionality