performing the encoding process