old_contents: from twisted.internet._threadedselect import install
  reactor = install()
  
  import objc, Foundation, AppKit, os, MGScopeBar
  from PyObjCTools import AppHelper
  
  def loadFramework(frameworkName):
      base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks')
      bundle_path = os.path.abspath(
          os.path.join(base_path, '%s.framework' % frameworkName)
          )
      objc.loadBundle(frameworkName, globals(), bundle_path=bundle_path) 
  
  #base_path = os.path.join(os.path.dirname(os.getcwd()), 'Frameworks')
  #bundle_path = os.path.abspath(
  #    os.path.join(base_path, 'BWToolkitFramework.framework')
  #    )
  #objc.loadBundle('BWToolkitFramework', globals(), bundle_path=bundle_path) 
  loadFramework('BWToolkitFramework')
  
  objc.loadBundle("Automator", globals(),
                  bundle_path="/System/Library/Frameworks/Automator.framework")
  
  # import modules containing classes required to start application and
  # load MainMenu.nib:
  from friendly import app, master, account, contacts
  
  # pass control to AppKit
  reactor.interleave(AppHelper.callAfter)
  reactor.addSystemEventTrigger('after', 'shutdown', AppHelper.stopEventLoop)
  AppHelper.runEventLoop()
  
new_contents: # This file is part of Friendly.
  # Copyright (c) 2009 Johan Rydberg <johan.rydberg@gmail.com>
  #
  # Permission is hereby granted, free of charge, to any person
  # obtaining a copy of this software and associated documentation
  # files (the "Software"), to deal in the Software without
  # restriction, including without limitation the rights to use,
  # copy, modify, merge, publish, distribute, sublicense, and/or sell
  # copies of the Software, and to permit persons to whom the
  # Software is furnished to do so, subject to the following
  # conditions:
  #
  # The above copyright notice and this permission notice shall be
  # included in all copies or substantial portions of the Software.
  #
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  # OTHER DEALINGS IN THE SOFTWARE.
  
  from twisted.internet._threadedselect import install
  reactor = install()
  
  from PyObjCTools import AppHelper
  
  import Automator
  import BWToolkitFramework
  import Foundation
  import AppKit
  import MGScopeBar
  import objc
  
  # import modules containing classes required to start application and
  # load MainMenu.nib:
  from friendly import app, master, account, contacts
  
  # pass control to AppKit
  reactor.interleave(AppHelper.callAfter)
  reactor.addSystemEventTrigger('after', 'shutdown', AppHelper.stopEventLoop)
  AppHelper.runEventLoop()
  
subject: Clean up main.py.