Bot: Use localStorage instead of sessionStorage

Also simplify code