altered calculate max height