Refactor to use Chart class