update size and implement height recursively