merge code
add progress dialog