Reorganized for Chrome/Firefox addon specific code