Added array padding function.