now works with big datasets