flexible encoding