Seperated the generation of the window