bookmarklet refactor and auth fix