add decode function.