Add encoding method