add function to calculate height