changed to decode after scan