Made the process of building a frame a function.