improved a login/logout state implementation between the background and the popup scripts