added child height balancing function