Refinement of chart code