restructuring code so it can be re-used in the non-bookmarklet form
backup form on main page