Updated js to compute the height better