better way to populate arrays