catered for empty array