Variable scope fixes, chart tweaks