Implemented download function.