added download attachment function