implemented decode