clean up chart code and prepare for choices