Move bridge detection to its own method