Replace the three places where you use this forEach/remove pattern, it misbehaves and only deletes half of the items!
while(availableApps.firstChild)
  availableApps.removeChild(availableApps.firstChild);
or
availableApps.innerHTML="";
or any other working solution ;)