Moved window creation code to Window class.