Remove innerHTML assignments.
Fix bug where elements were not emptied and created helper function.