added download functionality