Added decoding of docs and onehots. To be updated.