Tweaking globalTag-related code to make the logic clearer