added sub-sampling; 4-5x speedup