Download function and other updates