Simplified heightBefore calculation