Consolidate some array manipulation.