Moved out frame buffer code into separate file