extract common bridge code.