Download function

Package download functionality has been moved into its own private function, to
support future updates.