Move most of main method into processorfactory.