Chart refactor

Improving the Chart implementation, and also a good clean-up on the code.