decode, encode function. Extend view and category.