Fix id referencing. Fix state ref name. Remove some attribtues at the order.