complete rewrite with dom based ui