Refactor graphic's module code