add progress dialog, optimize work toward database