Remove unnecessary array_push calls.