Added function to chunk array