add charting, refactor to use io library