Refactor code to move out of global namespace
Charts are rendering properly