cleaning up charts code