cpchop refactored to allow multithreading