Refactoring some code in CBGLGraphic