removed most of the global variables that is passed to multiprocesses