change algo

only take care of vertical blocks