added decodeImproved