Core function to download content