Refactor of bridge.rb