Optimize setting of height