added multiprocess support
needs to be tweaked