Updated equal height function