[stable] more refactoring

Signed-off-by: Harry Truong <harry.truong@redcross.org>
fixed browser addon bug (avoid clearing DOM unnecessarily!)

Signed-off-by: Harry Truong <harry.truong@redcross.org>