Relocate high-level functions and add download function.