refactored graph controls to make it non-global