Move code out of createWindow() that does not have to be there