refactoring as a bookmarklet