Modified to deal with huge volumes