line graph demo, refactoring