further work on different modes like socket and BatchJobs. not done