breaking into smaller arrays because of memory limitations