Introduce factory method for main class.