added decoding functionality