beginning refactoring on graphics branch