Made decode methods generic.