went back to Alex's version because of a segfault in the integrated version