Make the window initialize process more reasonable