Factorizing some code, removing unnecessary framebuffers