added download funciton