Extract setHeight function from closure