moved updateHeight function into Document object