adding arrows to move the global g

adding the 4 small keyboard arrows to move the graph;
some refactoring

renaming and grouping repeating logic and vars;