improved decode