Implemented padding during encoding.