STABLE VERSION: resetting chains instead of creating new ones every time. also, dic is computed in both versions. valgrind check passed in cpu version and cuda-memcheck passed in gpu version. valgrind shows a small memory leak in the gpu verison somewhere, but it wont tell me where. it could be that valgrind is incorrectly observing the gpu, but i dont know.