refactoring gfx class to abstract the rendering