simplified and corrected the vertical log bin logic.