1. A method comprising: receiving a syntax element to be encoded as a code word of a set of code words; determining a mapping between the syntax element and the code word on the basis of a hierarchy level in a tree structure; using the mapping to obtain the code word; and updating the mapping.