Added tree height function