WIP move commandline processing out of main