Pass command line arguments to next instance on restart

Handle command line arguments in separate function.