Added key as optinal parameter to download function.