Refactoring some function in CBGraphic