smart value encoding