Changed to .map instead of .foreach to create arrays