Fixed refresh bug

Fixed a bug where refreshing would be done too early, added a count for
how many done and am now checking it against the number of selected so
it only refreshes once done!