Split out core.py from main.py.

main.py is now responsible only for bootstraping. This includes
parsing command line arguments, loading configuration, and
initializing logging.