Added correctness test and threading