Finally re-implement proper jwzthreading algorithm