Better current branch detection