changed the logic of vertical middle