Refactored some of the code in the bridge demo.