Creating a Framebuffer class, moving and factorizing the concerned code