Refactor __main__.