Use filter to format array