remove common header and fill array plus function