completely rewrite as jQuery widget