starting to extract functions into ChartService