added format modifier for first and last element of an array