Make common centering method and center windows