Refactored the BridgeDetector class to expose a cleaner API and make it stateful