add support for setting algorithm/nfactor for each pool separately, and fix bugged OpenCL thread cleanup (thread shutdown)
Change algorithm more robustly and faster, previous way was buggy