Got encoding of data working