add another encode method