now works ok on big dataset