Modify code for graphic device