Initial refactoring of graphics interface