Fixing previous commit while improving performance

Using html to replace the element won't add the data associated with the sidebar.

Fixing pull request #120