chart is working, needs testing and refactoring