I've updated the code because of a bug: if there where too many height points, the chance that the script crashes was high, because of division by zero. Fixed it.