Refactor the view refreshes

Instead of emptying out the element and re-filling it, create it
off-screen and replace the entry in the DOM all at once.

Make use of forEach() instead of iterating over keys.