Changed from innerHTML to insertChild, this approach does not remove all the event handlers and removed the entire dom rebuild
Fixed loop bug where referenced were called multiple times
Style improvements